import request from "@/config/request.js";

const fileApi = {
  selectAll: "/file/selectAll",
  selectByPage: "/file/selectByPage",
  detail: "/file/selectById",
  insert: "/file/insert",
  update: "/file/update",
  remove: "/file/remove",
  upload: "/file/upload",
};


/**
 * 删除分类
 * @param {*} params
 * @returns
 */
export const upload = params => {
  return request.post(fileApi.upload, params, {
    headers: {
      'content-type': 'multipart/form-data'
    },
  });
};

/**
 * 分类列表
 * @param {*} params
 * @returns
 */
export const selectAll = params => {
  return request.get(fileApi.selectAll, { params });
};

/**
 * 分类列表
 * @param {*} params
 * @returns
 */
export const selectByPage = params => {
  return request.get(fileApi.selectByPage, { params });
};

/**
 * 分类详情
 * @param {*} params
 * @returns
 */
export const detail = params => {
  return request.get(fileApi.detail, { params });
};

/**
 * 添加分类
 * @param {*} params
 * @returns
 */
export const insert = params => {
  return request.post(fileApi.insert, params);
};

/**
 * 更新分类
 * @param {*} params
 * @returns
 */
export const update = params => {
  return request.put(fileApi.update, params);
};

/**
 * 删除分类
 * @param {*} params
 * @returns
 */
export const remove = params => {
  return request.delete(fileApi.remove, params);
};
